/*
  File:    Polynomial.h
  Purpose: Polynomial class, as well as derivatives.

  Contact: Paul Macklin
           pmacklin@math.uci.edu
		  http://math.uci.edu/~pmacklin
*/

#ifndef __Polynomial_h_
#define __Polynomial_h_

class Polynomial
{
 private:
  double* coefficients;
  int degree;
  char variable; 

 public:
 
 double Evaluate( double input );

 double operator()( double input );
 Polynomial();
 Polynomial( int NewDegree );
 
 ~Polynomial();
 Polynomial( const Polynomial& Input );
 Polynomial& operator=( const Polynomial& Input );
 
  
 bool SetDegree( int NewDegree );
 int GetDegree( void ) const;
 
 bool SetVariable( char input );
 char GetVariable( void ) const; 
 
 // sets a_i in a_0 + a_1 x + ... 
 bool SetCoefficient( int Term, double Coefficient ); 
 double GetCoefficient( int Term ) const;
 void display( void );
 
 double norm2( void );
};

Polynomial Derivative( Polynomial& Input );
Polynomial SecondDerivative( Polynomial& Input );
Polynomial NthDerivative( Polynomial& Input , int order );

#endif
